﻿@model HZU.ZP.Domain.Model.PositionView
@{
    switch (User.Claims.ToList()[2].Value)
    {
        case "Company":
            Layout = "_CompanyLayout";
            break;
        case "Applicant":
            Layout = "_ApplicatLayout";
            break;
    }
}
<script>
    $(document).ready(function () {
        $("#collectRecord").click(function () {
            $.ajax({
            type: 'post',
            url: '/Record/AddCollect',
            data: 'email=@User.Identity.Name&positionId=@Model.Position.Id',
            success: function (message) {
                if (message.returnCode == "001")
                    alert("收藏成功！");
                else if (message.returnCode == "999")
                    alert("已存在收藏！");
            }
        });
        });
        $("#applyRecord").click(function () {
            $.ajax({
            type: 'post',
            url: '/ApplyRecord/Add',
            data: 'email=@User.Identity.Name&positionId=@Model.Position.Id',
            success: function (message) {
                if (message.returnCode == "001")
                    alert("申请成功！");
                else if (message.returnCode == "4040")
                    alert("用户不存在，请重新登录！");
                else if (message.returnCode == "4050")
                    alert("简历基本信息不全，请先完善！");
                else if (message.returnCode == "4060")
                    alert("该职位不存在！");
                else if (message.returnCode == "4070")
                    alert("已存在申请！");
            }
        });
        });

     });
</script>
<div class="container">
    <div class="row clearfix">
        <div class="col-md-12 column">
            <h3>@Model.Position.Name</h3>
            <p><a href="/CompanyInformation/GetCompanyInformationA?companyId=@Model.CompanyInformation.CompanyId" style="color:black">@Model.CompanyInformation.CompanyName</a></p>
            <p>
                @Model.Position.Provincial-@Model.Position.Municipal&nbsp;|&nbsp;@Model.Position.BigPosition-@Model.Position.SmallPosition&nbsp;|&nbsp;
                @Model.Position.Salary&nbsp;|&nbsp;招@(Model.Position.RecruitNumber)&nbsp;|&nbsp;
                @(Model.Position.CreateTime.ToString("yyyy-MM-dd"))&nbsp;发布
            </p>
            <dl>
                <dt>
                    职位描述
                </dt>
                <dd>
                    <textarea style="border:none; height:128px;width:98%" readonly>@Model.Position.JobDescription</textarea>
                </dd>
                <dt>
                    职位要求
                </dt>
                <dd>
                    <textarea style="border:none; height:128px;width:98%" readonly>@Model.Position.JobRequirement</textarea>
                </dd>
                <dt>
                    联系方式
                </dt>
                <dd>
                    <p>地址：@Model.CompanyInformation.Address</p>
                    <br />
                </dd>
                <dt>
                    企业简介
                </dt>
                <dd>
                    <textarea style="border:none; height:128px;width:98%" readonly>@Model.CompanyInformation.CompayIntroduction</textarea>
                </dd>
            </dl>
        </div>
    </div>
    <div class="row clearfix">
        <div class="col-md-2 column">
            <button type="button" class="btn btn-default btn-danger" style="width:100%" id="collectRecord">收藏</button>
        </div>
        <div class="col-md-5 column">
            <button type="button" class="btn btn-default btn-warning" style="width:50%" id="applyRecord">立即申请</button>
        </div>
        <div class="col-md-5 column">
            <a href="/Message/Allmsg?email=@User.Identity.Name&toEmail=@Model.CompanyInformation.Email" type="button" class="btn btn-default btn-info" style="width:50%;float:right;">立即沟通</a>
        </div>
    </div>
</div>
